home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
cntrlc
/
trick.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
3KB
|
102 lines
VERSION 2.00
Begin Form Form1
Caption = "Form1"
ClientHeight = 3060
ClientLeft = 690
ClientTop = 1485
ClientWidth = 6510
Height = 3465
Left = 630
LinkTopic = "Form1"
ScaleHeight = 3060
ScaleWidth = 6510
Top = 1140
Width = 6630
Begin ComboBox Combo1
Height = 300
Left = 120
TabIndex = 3
Text = "FRAME"
Top = 600
Width = 1455
End
Begin Frame Frame1
Caption = "0"
Height = 1695
Index = 0
Left = 1800
TabIndex = 0
Top = 480
Width = 3135
Begin CheckBox Check1
Caption = "Check1"
Height = 375
Index = 0
Left = 120
TabIndex = 1
Top = 600
Width = 2655
End
End
Begin Label Label2
Caption = "Select Frame"
Height = 255
Left = 120
TabIndex = 4
Top = 240
Width = 1215
End
Begin Label Label1
Caption = "CLICK ON FORM TO CREATE NEW FRAME"
Height = 855
Left = 120
TabIndex = 2
Top = 2160
Width = 1335
End
End
Option Explicit
Declare Function SetParent Lib "User" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer
Sub Check1_Click (index As Integer)
End Sub
Sub Combo1_click ()
frame1(combo1.ListIndex).ZOrder 0
End Sub
Sub Form_click ()
Static inext As Integer ' Declare Frame Counter
Dim A As Integer ' Dummy for SetParent
Dim newFrameHnd As Integer ' New Frame Handle
inext = inext + 1 ' Increment Counter
Load frame1(inext) 'Create new Frame
Load check1(inext) 'Create new checkbox
newFrameHnd = frame1(inext).hWnd 'Get new Frame Handle
'**** AND THE TRICK IS.... ****
A = SetParent(check1(inext).hWnd, newFrameHnd) 'Set Checkbox parent handle to New Frame handle
frame1(inext).Caption = Str$(inext) 'Give new Frame a name
check1(inext).Caption = "This is on Form " + Str(inext) 'Checkbox name
frame1(inext).Top = frame1(inext - 1).Top + 250 'Position
frame1(inext).Left = frame1(inext - 1).Left + 250
check1(inext).Visible = -1 'Make Visible
frame1(inext).Visible = -1
frame1(inext).ZOrder 0 'Frame comes to front
combo1.AddItem Str$(inext) ' Add to list
End Sub
Sub Form_Load ()
combo1.AddItem " 0"
End Sub